package demo5;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-09-03
 * Time: 23:13
 */
public class Thread2 {
    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 10; i++) {
            Thread thread1 = new Thread(() -> {
                System.out.print('A');
            });

            Thread thread2 = new Thread(() -> {
                try {
                    thread1.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.print('B');
            });

            Thread thread3 = new Thread(() -> {
            Thread thread3 = new Thread(() -> {
                try {
                    thread2.join();
                } catch (InterruptedException e) {h
                    e.printStackTrace();
                }
                System.out.print('C');
            });

            thread1.start();
            thread2.start();
            thread3.start();
            thread3.join();
            System.out.println();
        }
    }
}
